﻿<%@ include file="/global/jsp-header.jsp" %>
<!DOCTYPE html>
<html>
	<head>
		<title>Commons Demos</title>
		<link href="/static/ligerUI/skins/Aqua/css/ligerui-all.css"
		rel="stylesheet" type="text/css" />
		<script src="/static/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
		<script src="/static/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
		<script type="text/javascript">
	var tab = null;
	var accordion = null;
	var tree = null;
	$(function() {
		//布局
		$("#layoutDiv").ligerLayout({
			leftWidth : 186,
			height : '100%',
			heightDiff : -34,
			space : 4,
			onHeightChanged : f_heightChanged
		});

		var height = $(".l-layout-center").height();

		//Tab
		$("#framecenter").ligerTab({
			height : height
		});

		//面板
		$("#userTreeDiv").ligerAccordion({
			height : height - 24,
			speed : null
		});

		$(".l-link").hover(function() {
			$(this).addClass("l-link-over");
		}, function() {
			$(this).removeClass("l-link-over");
		});
		tab = $("#framecenter").ligerGetTabManager();
		$("#userTree").ligerTree({ checkbox: false ,nodeWidth : 120,onSelect:onSelect});
		accordion = $("#userTreeDiv").ligerGetAccordionManager();
		tree = $("#userTree").ligerGetTreeManager();
		$("#pageloading").hide();
		getCurrentWorkerInfo();
	});
	
	function onSelect(node)
    {
          if (!node.data.url) return;
          var tabid = $(node.target).attr("tabid");
          if (!tabid)
          {
              tabid = new Date().getTime();
              $(node.target).attr("tabid", tabid);
          } 
          f_addTab(tabid, node.data.text, node.data.url);
    }

	
	function f_heightChanged(options) {
		if (tab)
			tab.addHeight(options.diff);
		if (accordion && options.middleHeight - 24 > 0)
			accordion.setHeight(options.middleHeight - 24);
	}
	
	//增加一个tab
	function f_addTab(tabid, text, url) {
		tab.addTabItem({
			tabid : tabid,
			text : text,
			url : url
		});
	}
	
	//替换当前tab
	function f_overrideTab(text,value) {
		tab.overrideSelectedTabItem({ text:text,url: value });
	}
	
	//删除当前tab
	function f_removeSelectedTab(){
		tab.removeSelectedTabItem();
	}
	
	//重新加载当前tab
	function f_reloadTab(){
		tab.reload(tab.getSelectedTabItemID());
	}
	
	//获取当前登录员工信息
	function getCurrentWorkerInfo(){
		$.getJSON("/worker/current-worker.do", function(json) { 
			 $("#curWorkerName").html("欢迎"+json.workerName+"("+json.workerId+")");
		});
	}
</script>
<link href="/static/css/layout.css" rel="stylesheet" type="text/css" />
	</head>
	<body style="padding: 0px; background: #EAEEF5;">
		<div id="pageloading"></div>
		<div id="topmenu" class="l-topmenu">
			<div class="l-topmenu-logo">
				管理系统
			</div>
			<div class="l-topmenu-welcome">
				<span id="curWorkerName"></span>
				<span class="space">|</span>
				<a href="/logout.do" class="l-link2" >登出</a>
			</div>
		</div>
		<div id="layoutDiv"
			style="width: 99%; margin: 0 auto; margin-top: 4px;">
			<div position="left" title="" id="userTreeDiv">
				<!-- <div title="系统管理" class="l-scroll"> -->
					<ul id="userTree">
						<c:forEach items="${menuFolders }" var="item">
					        <li isexpand="false">
					            <span>${item.menu.menuName }</span>
					            <ul>
					            	 <c:forEach items="${item.childs }" var="childMenu">
					               		  <li url="${childMenu.url }"><span>${childMenu.menuName }</span></li>
					                 </c:forEach>
					            </ul>
					        </li> 
					    </c:forEach>
				    </ul>
				<!--</div> -->
			</div>
			<div position="center" id="framecenter">
				<div tabid="home" title="我的主页" style="height: 300px">
					<iframe frameborder="0" name="home" id="home" src="welcome.jsp"></iframe>
				</div>
			</div>
		</div>
		<div style="height: 32px; line-height: 32px; text-align: center;">
			Copyright © 2011-2012 www.ligerui.com
		</div>
		<div style="display: none"></div>
	</body>
</html>
